//
//  ParsingStore.swift
//  RoBiliBiliHotVideo
//
//  Created by 罗万能 on 2025/7/5.
//
import Foundation
import SwiftUI

@available(macOS 10.15.0, iOS 13.0.0, *)
class ParsingStore{
    public static func parsing(bvid: String) async -> ParsingVideo?{
        let baseUrl = "https://api.mir6.com/api/bzjiexi?url=https://www.bilibili.com/video/\(bvid)/&type=json"
        let url = URL(string: baseUrl)!
        let session = URLSession.shared
        do{
            let (data,_) = try await session.data(from: url)
            return ParsingVideo.create(from: data)
        }catch{
            print(error)
            return nil
        }
    }
}
